package com.egao.common.module.aolan.controller;

import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.common.core.web.PageParam;
import com.egao.common.core.web.PageResult;
import com.egao.common.module.aolan.service.AoLanService;
import com.egao.common.module.student.entity.StudentSign;
import com.egao.common.module.student.entity.StudentSignSet;
import com.egao.common.module.student.entity.vo.StudentSignAdminListVO;
import com.egao.common.module.student.service.StudentSignService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 奥兰控制器
 *
 * @author lym
 */
@Api(tags = "奥兰")
@RestController
@RequestMapping("${api}")
public class AoLanController extends BaseController {

    @Autowired
    private AoLanService aoLanService;
    @Autowired
    private StudentSignService studentSignService;

    @GetMapping("/publicly/ao-lan")
    private JsonResult aoLan(HttpServletRequest request) {
//        aoLanService.insert(studentSignService.getById(id));
        String key = request.getParameter("key");
        if (!"aoLanKeys".equals(key)) {
            return JsonResult.error("none");
        }
        return aoLanService.insertBatch(2022);

//        PageParam<StudentSignAdminListVO> pageParam = new PageParam<>(request);
//        pageParam.setSize(1000);
//        pageParam.put("yearId", "2021");
//        pageParam.put("category", "4");
//        pageParam.put("collegeCode", "28");
//        pageParam.put("signCategory", "10");
//        PageResult<StudentSignAdminListVO> list = studentSignService.listAdminPage(pageParam);
//        for (StudentSignAdminListVO item : list.getData()) {
//            aoLanService.insert(studentSignService.getById(item.getId()));
//        }

//        Integer[] ids ={19302,22181,26975,26879,27037,26890,26834,26832,26729,24505,27007,26769,26774,27045,26801,24580,27014,25092};
//        for (Integer id : ids) {
//            aoLanService.insert(studentSignService.getById(id));
//        }
//        return JsonResult.ok();
    }


}
